package vn.vng.research.fsd;
/*
 ** writen by hanv
 ** n2.vietha@gmail.com
 */


import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;


public class Configuration {
	private static final String CONFIG_PATH = "./client-config/config.properties";

	public static Properties properties;

	//
	// load config
	//
	public static void load() {
		try {
			properties = new Properties();
			properties.load(new FileInputStream(CONFIG_PATH));
		} catch (Exception e) {
			// TODO: handle exception
		}
	}

	//
	// Paths
	//

	
	//
	// Port and Host
	//
	public static int loadPort(String service){
		try {
			return Integer.parseInt(properties.getProperty(service+"_service_port"));
		} catch (Exception e) {
			// TODO: handle exception
			return 10700;
		}
	}
	
	public static String loadHost(String service){
		try {
			return properties.getProperty(service+"_service_host");
		} catch (Exception e) {
			// TODO: handle exception
			return "127.0.0.1";
		}
	}
}
